package com.shiguiwu.springmybatis.spring.lifecycle.destroy;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;

/**
 * @description: 销毁时调用的代码
 * @author: stone
 * @date: Created by 2021/3/28 14:55
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.lifecycle.destroy
 */
public class MyDestructionAwareBeanPostProcessor implements DestructionAwareBeanPostProcessor {
    @Override
    public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
        System.out.println("准备销毁bean：" + beanName);
    }

    @Override
    public boolean requiresDestruction(Object bean) {
        System.out.println("是否调用。。。。。。。");
        return true;
    }
}
